/* 
 * File:   Server.h
 * Author: Lance
 *
 * Created on September 29, 2012, 10:42 PM
 */

#ifndef SERVER_H
#define	SERVER_H

#include "ClientHandler.h"
#include "ThreadPool.h"
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <iostream>

using namespace std;

class Server {
public:
	Server(int port, bool debug);
	Server(const Server& orig);
	virtual ~Server();
	bool debug;
private:
	void init(int port);
	void initSocket();
	void socketListen();
	
	struct sockaddr_in server, client;
	socklen_t clientlength;
	int port, socket_handle;
	ThreadPool threadPool;
};

#endif	/* SERVER_H */

